﻿//https://leetcode.cn/problems/remove-duplicates-from-sorted-array/submissions/600574119/

class Solution {
public:
    int removeDuplicates(vector<int>& nums)
    {
        int left = 0, right = 0;
        int n = nums.size();
        while (++right < n)
        {
            if (nums[left] != nums[right])
            {
                swap(nums[++left], nums[right]);
            }
        }
        return left + 1;
    }
};